﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="QuanLyDonVi.ascx.cs"
    Inherits="Solutions.Admin.QuanLyDonVi.QuanLyDonVi" %>
<style type="text/css">
    .marginleft10
    {
        position: relative;
        float: left;
        margin-left: 10px;
    }
    .dxgvTable_Aqua caption
    {
        height: 30px !important;
        line-height: 30px;
        font-weight: bold;
    }
    .redLabel
    {
        color: Red;
    }
</style>
<dx:ASPxButton ID="btnOpenForm" runat="server" AutoPostBack="False" EncodeHtml="False"
    Height="22px" Text="Thêm mới" OnClick="btnOpenForm_Click">
    <Image Url="../Skins/style/IMG/icon/Add.png" Width="16px" Height="16px" />
</dx:ASPxButton>
<dx:ASPxGridView ID="grdQuanLyDonVi" runat="server" Width="100%" OnRowCommand="grdQuanLyDonVi_RowCommand"
    KeyFieldName="pk_iDonViID" Caption="Quản lý đơn vị">
    <Columns>
        <dx:GridViewDataTextColumn Caption="STT" VisibleIndex="0" Width="40" HeaderStyle-HorizontalAlign="Center"
            CellStyle-HorizontalAlign="Center" CellStyle-Font-Bold="true" HeaderStyle-Font-Bold="true">
            <DataItemTemplate>
                <%#Container.ItemIndex + 1 %>
            </DataItemTemplate>
        </dx:GridViewDataTextColumn>
        <dx:GridViewDataTextColumn FieldName="sMaDonVi" Width="80" Caption="Mã đơn vị" VisibleIndex="1"
            HeaderStyle-Font-Bold="true" />
        <dx:GridViewDataTextColumn Caption="Tên đơn vị" VisibleIndex="1" Width="250" HeaderStyle-Font-Bold="true">
            <DataItemTemplate>
                <a style="color: #000;">
                    <%#Eval("sTenDonVi") %></a>
            </DataItemTemplate>
        </dx:GridViewDataTextColumn>
        <dx:GridViewDataTextColumn FieldName="sDiaChi" Width="200" Caption="Địa chỉ" VisibleIndex="2"
            HeaderStyle-Font-Bold="true" />
        <dx:GridViewDataTextColumn FieldName="sGhiChu" Width="200" Caption="Ghi chú" VisibleIndex="2"
            HeaderStyle-Font-Bold="true" />
        <dx:GridViewDataTextColumn Caption="Edit" VisibleIndex="3" Width="30" HeaderStyle-HorizontalAlign="Center"
            CellStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true">
            <DataItemTemplate>
                <asp:ImageButton ID="imgEdit" runat="server" CommandName="Edit" ImageUrl="../Skins/style/IMG/icon/Edit.png"
                    ClientIDMode="Static" />
            </DataItemTemplate>
        </dx:GridViewDataTextColumn>
        <dx:GridViewDataTextColumn Caption="Delete" VisibleIndex="4" Width="30" HeaderStyle-HorizontalAlign="Center"
            CellStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true">
            <DataItemTemplate>
                <asp:ImageButton ID="imgDel" runat="server" CommandName="Delete" ImageUrl="../Skins/style/IMG/icon/Delete.png"
                    ClientIDMode="Static" />
            </DataItemTemplate>
        </dx:GridViewDataTextColumn>
    </Columns>
    <Styles>
        <AlternatingRow Enabled="true" />
    </Styles>
    <SettingsBehavior AllowSelectByRowClick="true" />
    <Settings VerticalScrollableHeight="430" ShowGroupPanel="false" ShowFilterRow="true" />
    <SettingsPager Position="Bottom" PageSize="20">
        <PageSizeItemSettings Items="10, 20, 50" />
    </SettingsPager>
</dx:ASPxGridView>
<dx:ASPxTextBox runat="server" ID="txtpk_iDonViID" Visible="false">
</dx:ASPxTextBox>
<dx:ASPxPopupControl ID="wdsQuanLyDonVi" runat="server" ClientInstanceName="popupControl"
    Width="500px" Height="380px" Modal="True" CloseAction="CloseButton" AllowDragging="True"
    PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" HeaderText="Quản lý đơn vị"
    ClientIDMode="Static">
    <ContentCollection>
        <dx:PopupControlContentControl ID="PopupControlContentControl1" runat="server">
            <br />
            <table style="margin-left: 40px;">
                <tr>
                    <td>
                        <p style="width: 120px;">
                            Mã đơn vị <span class="redLabel">(*)</span>:</p>
                    </td>
                    <td>
                        <dx:ASPxTextBox runat="server" ID="txtMaDonVi" Width="250px" Height="26px" MaxLength="10">
                        </dx:ASPxTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p style="width: 120px;">
                            Đơn vị cha <span class="redLabel">(*)</span>:</p>
                    </td>
                    <td>
                        <dx:ASPxComboBox runat="server" ID="cboDonViCha" ValueField="pk_iDonViID" TextField="sTenDonVi"
                            EnableCallbackMode="true" IncrementalFilteringMode="StartsWith" Height="26px"
                            Width="250px" RightToLeft="False" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <p style="width: 120px;">
                            Tên đơn vị <span class="redLabel">(*)</span>:</p>
                    </td>
                    <td>
                        <dx:ASPxTextBox runat="server" ID="txtTenDonVi" Width="250px" Height="26px" MaxLength="200">
                        </dx:ASPxTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p style="width: 120px;">
                            Địa chỉ:</p>
                    </td>
                    <td>
                        <dx:ASPxTextBox runat="server" ID="txtDiaChi" Width="250px" Height="26px" MaxLength="250">
                        </dx:ASPxTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p style="width: 120px;">
                            Ghi chú:</p>
                    </td>
                    <td>
                        <dx:ASPxMemo runat="server" ID="txtGhiChu" Width="250px" Height="60px" MaxLength="1000">
                        </dx:ASPxMemo>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p style="width: 120px;">
                            Trạng thái:</p>
                    </td>
                    <td>
                        <dx:ASPxCheckBox runat="server" ID="chkKichHoat" Checked="false" Text="Kích hoạt">
                        </dx:ASPxCheckBox>
                    </td>
                </tr>
            </table>
            <table style="margin-top: 50px;">
                <tr>
                    <td style="width: 240px;">
                    </td>
                    <td>
                        <dx:ASPxButton ID="btnLuuLai" runat="server" AutoPostBack="False" Text="Lưu lại"
                             OnClick="btnLuuLai_Click">
                            <Image Url="../Skins/style/IMG/icon/Save.png" Width="16px" Height="16px" />
                        </dx:ASPxButton>
                        <dx:ASPxButton ID="btnLuuSua" runat="server" AutoPostBack="False" Text="Lưu lại"
                             OnClick="btnLuuSua_Click" Visible="false">
                            <Image Url="../Skins/style/IMG/icon/SaveEdit.png" Width="16px" Height="16px" />
                        </dx:ASPxButton>
                    </td>
                    <td style="position: relative; float: left; margin-left: 10px;">
                        <dx:ASPxButton ID="btnDong" runat="server" AutoPostBack="False" ClientInstanceName="btnDong"
                            Text="Đóng" >
                            <Image Url="../Skins/style/IMG/icon/Close.png" Width="16px" Height="16px" />
                            <ClientSideEvents Click="function(s, e) {popupControl.Hide();}" />
                        </dx:ASPxButton>
                    </td>
                </tr>
            </table>
        </dx:PopupControlContentControl>
    </ContentCollection>
</dx:ASPxPopupControl>
